package com.yjj.demo.thread.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 *
 *
 * @author yangjiajia
 * @time 2021/8/22 19:58
 */
@Service
public class MailService {

    private Logger logger = LoggerFactory.getLogger(MailService.class);

    public void send(String msg) {
        logger.info("发送邮件,msg:{}", msg);
    }

    @Async
    public void send1(String msg) {
        try {
            Thread.sleep(3000);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        logger.info("async-send,msg:{}", msg);
    }
}
